<template>
  <div>
    <el-button type="primary" icon="Download" @click="downloadFn">{{ name }}</el-button>
  </div>
</template>
<script setup>
const props = defineProps({
  name: {
    type: String,
    default:"模板下载"
  },
  fileName:{
    type: String,
    default:"单位参保信息.xlsx"
  },
  fileUrl:{
    type: String,
    default:"./downloadFile/单位参保信息.xlsx"
  }
})
function downloadFn(){
  downloadFiles(props.fileName, props.fileUrl);
}
const downloadFiles = (fileName, fileUrl) => {
  if (!fileUrl) {
    return;
  }
  let link = document.createElement("a");
  link.style.display = "none";
  link.href = fileUrl;
  link.setAttribute("download", fileName);
  document.body.appendChild(link);
  link.click();
};
</script>
<style lang="scss" scoped></style>